<@override name="head">
<#include "/inc/include-easyUI-css.html">

</@override>

<@override name="layout_main_content">
<div class="main-content">
	<div class="main-content-inner">
		<div class="breadcrumbs ace-save-state" id="breadcrumbs">
			<ul class="breadcrumb">
				<li><i class="ace-icon fa fa-home home-icon"></i> <a href="javascript:void(0)">首页</a>
				</li>
				<li class="active">消费统计管理</li>
			</ul>
			<!-- /.breadcrumb -->

			<!-- <div class="nav-search" id="nav-search">
				<form class="form-search">
					<span class="input-icon"> <input type="text"
						placeholder="Search ..." class="nav-search-input"
						id="nav-search-input" autocomplete="off" /> <i
						class="ace-icon fa fa-search nav-search-icon"></i>
					</span>
				</form>
			</div> -->
			<!-- /.nav-search -->
		</div>

		<div class="page-content">

			<div class="page-header">
				<h1>
					消费统计管理
					<small> 
						<i class="ace-icon fa fa-angle-double-right"></i> 
					</small>
				</h1>
			</div>
			<!-- /.page-header -->

			<div class="row">
				<div class="col-xs-12">
					<!-- PAGE CONTENT BEGINS -->
					
					<!-- 搜索form -->
					<form id="searchUserForm" action="" class="form-horizontal" role="form" >
						<div class="space-4"></div>
						<div class="form-group">
							<label class="col-sm-1 control-label no-padding-right" for="search-countDatetime"> 时间 </label>
							<div class="col-sm-9">
								<input type="text" id="search-countDatetime" name="countDatetime" 
									placeholder="时间" class="col-xs-4 col-sm-5" readonly="true"/>
								<div id="getBeginTime"></div>
								
								<div class="col-sm-3">
									<input type="text" name="consumeUserIds" id="consume-consumeUserIds" placeholder="消费人员" class="form-control" 
										style="height:30px;margin-left: 50px;"/>
								</div>
								
								<div>
			                        <button type="button" id="btn-search" class="btn btn-primary start" style="margin-left: 100px;">
					                    <i></i>
					                    <span>搜索</span>
					                </button>
					                <button type="reset" id="btn-reset" class="btn btn-warning cancel" style="margin-left: 20px;">
					                    <i></i>
					                    <span>取消</span>
					                </button>
	                           </div>
							</div>
						</div>
						<div class="space-4"></div>
					</form>
					<table id="consumeCountList" border="false" width="100%" height="450px"></table>
					
					<!-- PAGE CONTENT ENDS -->
				</div>
				<!-- /.col -->
			</div>
			<!-- /.row -->
		</div>
		<!-- /.page-content -->
	</div>
</div>
<!-- /.main-content -->
</@override>
<@override name="footer">
<#include "/inc/include-easyUI-js.html">
<script type="text/javascript">
	jeDate({
		dateCell:"#search-countDatetime",//直接显示日期层的容器，可以是ID  CLASS
		format:"YYYY-MM",//日期格式
		isinitVal:false, //是否初始化时间
		festival:false, //是否显示节日
		isTime:true, //是否开启时间选择
		minDate:"2017-06-01 00:00:00",//最小日期
		maxDate:jeDate.now(0), //设定最大日期为当前日期
	});
	var consumeCountGrid;
       $(function () {
           consumeCountGrid = $("#consumeCountList").datagrid({
               url: '${pageContext.request.contextPath}/admin/consumeCount/getList',
               rownumbers: true,
               fitColumns:true,
               idField: 'id',
               onLoadError:function(data){
               	
               },
               frozenColumns: [[{
                   title: 'id',
                   field: 'id',
                   width: 50,
                   checkbox: true,
                   hidden : true
               }]],
               columns: [[ {
                   field: 'userName',
                   title: '用户名',
                   align:'center',
                   width: 100,
               }, {
                   field: 'countDate',
                   title: '统计时间',
                   align:'center',
                   width: 100,
               }, {
                   field: 'totalPaid',
                   title: '总付款',
                   align:'center',
                   width: 100
               }, {
                   field: 'totalConsume',
                   title: '总消费',
                   align:'center',
                   width: 100
               }, {
                   field: 'totaliIncome',
                   title: '收入 ',
                   align:'center',
                   width: 100
               }, {
                   field: 'totalExpenditure',
                   title: '支出 ',
                   align:'center',
                   width: 100
               }
               ]],
           });
          
           $("#consume-consumeUserIds").combobox({
       	    url:'${pageContext.request.contextPath}/admin/sys/user/getUserComboList?userId=0',
       	    valueField:'value',
       	    textField:'text',
       	    multiple:true,
       	});
           
           //快速搜索按钮
   		$('#btn-search').click(function(){
   		   	consumeCountGrid.datagrid('unselectAll');
              	var countDatetime = $('#search-countDatetime').val();
              	var consumeUserIds = $("#consume-consumeUserIds").combobox('getValues');
   			consumeCountGrid.datagrid('load', {
   				countDatetime : countDatetime,
   				consumeUserIds : consumeUserIds.join(",")
   			});
   		});
           $('#btn-reset').click(function(){
           	 $("#consume-consumeUserIds").combobox('clear');
           })
       });
    
       function reloadDataGrid() {
           consumeCountGrid.datagrid('clearChecked');
           consumeCountGrid.datagrid('reload');
       }
</script>
</@override>
<@extends name="/layouts/admin-home.html"/>